/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ImprimirPlanillaLlamado.java
 *
 * Created on 21-ene-2013, 15:08:52
 */
package gui;

import com.sun.awt.AWTUtilities;
import controladores.ControladorPrincipal;
import io.Llamado;
import java.awt.Image;
import java.awt.Shape;
import java.awt.geom.RoundRectangle2D;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.swing.ImageIcon;
import utilidades.JFrameConFondo;

/**
 *
 * @author NiCo
 */
public class EstadisticaCasosMotivo extends JFrameConFondo {

    private Image icono = new ImageIcon(getClass().getResource("/imagenes/logo.png")).getImage();
    private ArrayList<Integer> estadistica = null;

    /** Creates new form ImprimirPlanillaLlamado */
    public EstadisticaCasosMotivo() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        btnCerrar = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        rbtnMotivo = new javax.swing.JRadioButton();
        rbtnMotivoLlamado = new javax.swing.JRadioButton();
        jPanel2 = new javax.swing.JPanel();
        rbtnMensual = new javax.swing.JRadioButton();
        dtpDiaria = new com.toedter.calendar.JDateChooser();
        rbtnDiaria = new javax.swing.JRadioButton();
        rbtnTrimestre = new javax.swing.JRadioButton();
        rbtnAnual = new javax.swing.JRadioButton();
        cboTrimestre = new javax.swing.JComboBox();
        dtpMes = new com.toedter.calendar.JMonthChooser();
        dtpAnio = new com.toedter.calendar.JYearChooser();
        dtpAnio1 = new com.toedter.calendar.JYearChooser();
        dtpAnio2 = new com.toedter.calendar.JYearChooser();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        btnCerrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cerrar-normal.png"))); // NOI18N
        btnCerrar.setBorder(null);
        btnCerrar.setBorderPainted(false);
        btnCerrar.setFocusPainted(false);
        btnCerrar.setName("btnCerrar"); // NOI18N
        btnCerrar.setOpaque(false);
        btnCerrar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                btnCerrarMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                btnCerrarMouseExited(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                btnCerrarMousePressed(evt);
            }
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                btnCerrarMouseReleased(evt);
            }
        });
        btnCerrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCerrarActionPerformed(evt);
            }
        });

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/titulo-estadistica-casos.png"))); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/ver-reporte.png"))); // NOI18N
        jButton1.setBorderPainted(false);
        jButton1.setFocusPainted(false);
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tipo de informe", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N

        buttonGroup2.add(rbtnMotivo);
        rbtnMotivo.setFont(new java.awt.Font("Tahoma", 0, 12));
        rbtnMotivo.setText("Por motivo");
        rbtnMotivo.setName("rbtnMotivo"); // NOI18N

        buttonGroup2.add(rbtnMotivoLlamado);
        rbtnMotivoLlamado.setFont(new java.awt.Font("Tahoma", 0, 12));
        rbtnMotivoLlamado.setText("Por motivo y tipo de llamado");
        rbtnMotivoLlamado.setName("rbtnMotivoLlamado"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(rbtnMotivo)
                    .addComponent(rbtnMotivoLlamado))
                .addContainerGap(130, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(rbtnMotivo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(rbtnMotivoLlamado)
                .addContainerGap(9, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Datos requeridos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N

        buttonGroup1.add(rbtnMensual);
        rbtnMensual.setFont(new java.awt.Font("Tahoma 12", 1, 12));
        rbtnMensual.setText("Mensual");
        rbtnMensual.setName("rbtnMensual"); // NOI18N
        rbtnMensual.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtnMensualActionPerformed(evt);
            }
        });

        dtpDiaria.setDateFormatString("dd/MM/yyyy");
        dtpDiaria.setEnabled(false);
        dtpDiaria.setFont(new java.awt.Font("Tahoma 12", 0, 12));
        dtpDiaria.setName("dtpDiaria"); // NOI18N

        buttonGroup1.add(rbtnDiaria);
        rbtnDiaria.setFont(new java.awt.Font("Tahoma 12", 1, 12));
        rbtnDiaria.setText("Diaria");
        rbtnDiaria.setName("rbtnDiaria"); // NOI18N
        rbtnDiaria.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtnDiariaActionPerformed(evt);
            }
        });

        buttonGroup1.add(rbtnTrimestre);
        rbtnTrimestre.setFont(new java.awt.Font("Tahoma 12", 1, 12));
        rbtnTrimestre.setText("Trimestral");
        rbtnTrimestre.setName("rbtnTrimestre"); // NOI18N
        rbtnTrimestre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtnTrimestreActionPerformed(evt);
            }
        });

        buttonGroup1.add(rbtnAnual);
        rbtnAnual.setFont(new java.awt.Font("Tahoma 12", 1, 12));
        rbtnAnual.setText("Anual");
        rbtnAnual.setName("rbtnAnual"); // NOI18N
        rbtnAnual.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtnAnualActionPerformed(evt);
            }
        });

        cboTrimestre.setFont(new java.awt.Font("Tahoma", 0, 12));
        cboTrimestre.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Primer trimestre", "Segundo trimestre", "Tercer trimestre", "Cuarto trimestre" }));
        cboTrimestre.setSelectedIndex(-1);
        cboTrimestre.setEnabled(false);
        cboTrimestre.setName("cboTrimestre"); // NOI18N

        dtpMes.setEnabled(false);
        dtpMes.setFont(new java.awt.Font("Tahoma", 0, 12));
        dtpMes.setName("dtpMes"); // NOI18N

        dtpAnio.setEnabled(false);
        dtpAnio.setName("dtpAnio"); // NOI18N

        dtpAnio1.setEnabled(false);
        dtpAnio1.setName("dtpAnio1"); // NOI18N

        dtpAnio2.setEnabled(false);
        dtpAnio2.setName("dtpAnio2"); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(rbtnMensual)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(dtpMes, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(dtpAnio1, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(rbtnDiaria)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(dtpDiaria, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(rbtnTrimestre)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(cboTrimestre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(dtpAnio2, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(rbtnAnual)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(dtpAnio, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(16, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(rbtnDiaria)
                    .addComponent(dtpDiaria, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(rbtnMensual)
                    .addComponent(dtpAnio1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(dtpMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(rbtnTrimestre)
                            .addComponent(cboTrimestre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(rbtnAnual)
                            .addComponent(dtpAnio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(dtpAnio2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(101, 101, 101)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 68, Short.MAX_VALUE)
                        .addComponent(btnCerrar)))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(104, Short.MAX_VALUE)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(103, 103, 103))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnCerrar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnCerrarMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCerrarMouseEntered

        btnCerrar.setIcon(new ImageIcon(getClass().getResource("/imagenes/cerrar-activo.png")));     }//GEN-LAST:event_btnCerrarMouseEntered

    private void btnCerrarMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCerrarMouseExited

        btnCerrar.setIcon(new ImageIcon(getClass().getResource("/imagenes/cerrar-normal.png")));     }//GEN-LAST:event_btnCerrarMouseExited

    private void btnCerrarMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCerrarMousePressed

        btnCerrar.setIcon(new ImageIcon(getClass().getResource("/imagenes/cerrar-click.png")));     }//GEN-LAST:event_btnCerrarMousePressed

    private void btnCerrarMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCerrarMouseReleased

        btnCerrar.setIcon(new ImageIcon(getClass().getResource("/imagenes/cerrar-normal.png")));     }//GEN-LAST:event_btnCerrarMouseReleased

    private void btnCerrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrarActionPerformed
        this.dispose();
    }//GEN-LAST:event_btnCerrarActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        if (rbtnMotivo.isSelected()) {
            List<Integer> valores = null;
            if (rbtnDiaria.isSelected() && dtpDiaria.getDate() != null) {
                valores = ControladorPrincipal.getInstance().getControladorEstadisticas().motivoDiario(dtpDiaria.getDate());
                if (valores != null) {
                    gui.reportes.CasosMotivos frm = new gui.reportes.CasosMotivos(valores, null, dtpDiaria.getDate(), -1, "", -1);
                    frm.setLocationRelativeTo(null);
                    frm.setIconImage(icono);
                    frm.setImagen("/imagenes/fondo.png");
                    frm.setVisible(true);
                    Shape shape = new RoundRectangle2D.Float(0, 0, frm.getWidth(), frm.getHeight(), 30, 30);
                    AWTUtilities.setWindowShape(frm, shape);
                } else {
                    MensajesInfo p1 = new MensajesInfo('n', "NoCaso");
                    p1.setLocationRelativeTo(null);
                    p1.setIconImage(icono);
                    p1.setVisible(true);
                    Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                    AWTUtilities.setWindowShape(p1, shape);
                }
            } else {
                if (rbtnMensual.isSelected() && dtpMes.getMonth() != -1 && dtpAnio1.getYear() != -1) {
                    valores = ControladorPrincipal.getInstance().getControladorEstadisticas().motivoMensual(dtpMes.getMonth() + 1, dtpAnio1.getYear());
                    if (valores != null) {
                        String mes = "";
                        switch (dtpMes.getMonth()) {
                            case 0:
                                mes = "Enero";
                                break;
                            case 1:
                                mes = "Febrero";
                                break;
                            case 2:
                                mes = "Marzo";
                                break;
                            case 3:
                                mes = "Abril";
                                break;
                            case 4:
                                mes = "Mayo";
                                break;
                            case 5:
                                mes = "Junio";
                                break;
                            case 6:
                                mes = "Julio";
                                break;
                            case 7:
                                mes = "Agosto";
                                break;
                            case 8:
                                mes = "Setiembre";
                                break;
                            case 9:
                                mes = "Octubre";
                                break;
                            case 10:
                                mes = "Noviembre";
                                break;
                            case 11:
                                mes = "Diciembre";
                                break;
                        }
                        gui.reportes.CasosMotivos frm = new gui.reportes.CasosMotivos(valores, null, null, -1, mes, dtpAnio1.getYear());
                        frm.setLocationRelativeTo(null);
                        frm.setIconImage(icono);
                        frm.setImagen("/imagenes/fondo.png");
                        frm.setVisible(true);
                        Shape shape = new RoundRectangle2D.Float(0, 0, frm.getWidth(), frm.getHeight(), 30, 30);
                        AWTUtilities.setWindowShape(frm, shape);
                    } else {
                        MensajesInfo p1 = new MensajesInfo('n', "NoCasoM");
                        p1.setLocationRelativeTo(null);
                        p1.setIconImage(icono);
                        p1.setVisible(true);
                        Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                        AWTUtilities.setWindowShape(p1, shape);
                    }
                } else {
                    if (rbtnTrimestre.isSelected() && cboTrimestre.getSelectedIndex() != -1) {
                        valores = ControladorPrincipal.getInstance().getControladorEstadisticas().motivoTrimestre(cboTrimestre.getSelectedIndex(), dtpAnio2.getYear());
                        if (valores != null) {
                            gui.reportes.CasosMotivos frm = new gui.reportes.CasosMotivos(valores, null, null, cboTrimestre.getSelectedIndex(), "", dtpAnio2.getYear());
                            frm.setLocationRelativeTo(null);
                            frm.setIconImage(icono);
                            frm.setImagen("/imagenes/fondo.png");
                            frm.setVisible(true);
                            Shape shape = new RoundRectangle2D.Float(0, 0, frm.getWidth(), frm.getHeight(), 30, 30);
                            AWTUtilities.setWindowShape(frm, shape);
                        } else {
                            MensajesInfo p1 = new MensajesInfo('n', "NoCasoT");
                            p1.setLocationRelativeTo(null);
                            p1.setIconImage(icono);
                            p1.setVisible(true);
                            Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                            AWTUtilities.setWindowShape(p1, shape);
                        }
                    } else {
                        if (rbtnAnual.isSelected() && dtpAnio.getYear() != -1) {
                            valores = ControladorPrincipal.getInstance().getControladorEstadisticas().motivoAnual(dtpAnio.getYear());
                            if (valores != null) {
                                gui.reportes.CasosMotivos frm = new gui.reportes.CasosMotivos(valores, null, null, -1, "", dtpAnio.getYear());
                                frm.setLocationRelativeTo(null);
                                frm.setIconImage(icono);
                                frm.setImagen("/imagenes/fondo.png");
                                frm.setVisible(true);
                                Shape shape = new RoundRectangle2D.Float(0, 0, frm.getWidth(), frm.getHeight(), 30, 30);
                                AWTUtilities.setWindowShape(frm, shape);
                            } else {
                                MensajesInfo p1 = new MensajesInfo('n', "NoCasoA");
                                p1.setLocationRelativeTo(null);
                                p1.setIconImage(icono);
                                p1.setVisible(true);
                                Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                                AWTUtilities.setWindowShape(p1, shape);
                            }
                        } else {
                            MensajesInfo p1 = new MensajesInfo('e', "CamposVacios");
                            p1.setLocationRelativeTo(null);
                            p1.setIconImage(icono);
                            p1.setVisible(true);
                            Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                            AWTUtilities.setWindowShape(p1, shape);
                        }
                    }
                }
            }
        } else {
            if (rbtnMotivoLlamado.isSelected()) {

                List<List<Integer>> valores = null;
                if (rbtnDiaria.isSelected() && dtpDiaria.getDate() != null) {
                    valores = ControladorPrincipal.getInstance().getControladorEstadisticas().motivoLlamadoDiario(dtpDiaria.getDate());
                    if (valores != null) {
                        gui.reportes.CasosMotivos frm = new gui.reportes.CasosMotivos(null, valores, dtpDiaria.getDate(), -1, "", -1);
                        frm.setLocationRelativeTo(null);
                        frm.setIconImage(icono);
                        frm.setImagen("/imagenes/fondo.png");
                        frm.setVisible(true);
                        Shape shape = new RoundRectangle2D.Float(0, 0, frm.getWidth(), frm.getHeight(), 30, 30);
                        AWTUtilities.setWindowShape(frm, shape);
                    } else {
                        MensajesInfo p1 = new MensajesInfo('n', "NoCaso");
                        p1.setLocationRelativeTo(null);
                        p1.setIconImage(icono);
                        p1.setVisible(true);
                        Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                        AWTUtilities.setWindowShape(p1, shape);
                    }
                } else {
                    if (rbtnMensual.isSelected() && dtpMes.getMonth() != -1 && dtpAnio1.getYear() != -1) {
                        valores = ControladorPrincipal.getInstance().getControladorEstadisticas().motivoLlamadoMensual(dtpMes.getMonth() + 1, dtpAnio1.getYear());
                        if (valores != null) {
                            String mes = "";
                            switch (dtpMes.getMonth()) {
                                case 0:
                                    mes = "Enero";
                                    break;
                                case 1:
                                    mes = "Febrero";
                                    break;
                                case 2:
                                    mes = "Marzo";
                                    break;
                                case 3:
                                    mes = "Abril";
                                    break;
                                case 4:
                                    mes = "Mayo";
                                    break;
                                case 5:
                                    mes = "Junio";
                                    break;
                                case 6:
                                    mes = "Julio";
                                    break;
                                case 7:
                                    mes = "Agosto";
                                    break;
                                case 8:
                                    mes = "Setiembre";
                                    break;
                                case 9:
                                    mes = "Octubre";
                                    break;
                                case 10:
                                    mes = "Noviembre";
                                    break;
                                case 11:
                                    mes = "Diciembre";
                                    break;
                            }
                            gui.reportes.CasosMotivos frm = new gui.reportes.CasosMotivos(null, valores, null, -1, mes, dtpAnio1.getYear());
                            frm.setLocationRelativeTo(null);
                            frm.setIconImage(icono);
                            frm.setImagen("/imagenes/fondo.png");
                            frm.setVisible(true);
                            Shape shape = new RoundRectangle2D.Float(0, 0, frm.getWidth(), frm.getHeight(), 30, 30);
                            AWTUtilities.setWindowShape(frm, shape);
                        } else {
                            MensajesInfo p1 = new MensajesInfo('n', "NoCasoM");
                            p1.setLocationRelativeTo(null);
                            p1.setIconImage(icono);
                            p1.setVisible(true);
                            Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                            AWTUtilities.setWindowShape(p1, shape);
                        }
                    } else {
                        if (rbtnTrimestre.isSelected() && cboTrimestre.getSelectedIndex() != -1) {
                            valores = ControladorPrincipal.getInstance().getControladorEstadisticas().motivoLlamadoTrimestre(cboTrimestre.getSelectedIndex(), dtpAnio2.getYear());
                            if (valores != null) {
                                gui.reportes.CasosMotivos frm = new gui.reportes.CasosMotivos(null, valores, null, cboTrimestre.getSelectedIndex(), "", dtpAnio2.getYear());
                                frm.setLocationRelativeTo(null);
                                frm.setIconImage(icono);
                                frm.setImagen("/imagenes/fondo.png");
                                frm.setVisible(true);
                                Shape shape = new RoundRectangle2D.Float(0, 0, frm.getWidth(), frm.getHeight(), 30, 30);
                                AWTUtilities.setWindowShape(frm, shape);
                            } else {
                                MensajesInfo p1 = new MensajesInfo('n', "NoCasoT");
                                p1.setLocationRelativeTo(null);
                                p1.setIconImage(icono);
                                p1.setVisible(true);
                                Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                                AWTUtilities.setWindowShape(p1, shape);
                            }
                        } else {
                            if (rbtnAnual.isSelected() && dtpAnio.getYear() != -1) {
                                valores = ControladorPrincipal.getInstance().getControladorEstadisticas().motivoLlamadoAnual(dtpAnio.getYear());
                                if (valores != null) {
                                    gui.reportes.CasosMotivos frm = new gui.reportes.CasosMotivos(null, valores, null, -1, "", dtpAnio.getYear());
                                    frm.setLocationRelativeTo(null);
                                    frm.setIconImage(icono);
                                    frm.setImagen("/imagenes/fondo.png");
                                    frm.setVisible(true);
                                    Shape shape = new RoundRectangle2D.Float(0, 0, frm.getWidth(), frm.getHeight(), 30, 30);
                                    AWTUtilities.setWindowShape(frm, shape);
                                } else {
                                    MensajesInfo p1 = new MensajesInfo('n', "NoCasoA");
                                    p1.setLocationRelativeTo(null);
                                    p1.setIconImage(icono);
                                    p1.setVisible(true);
                                    Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                                    AWTUtilities.setWindowShape(p1, shape);
                                }
                            } else {
                                MensajesInfo p1 = new MensajesInfo('e', "CamposVacios");
                                p1.setLocationRelativeTo(null);
                                p1.setIconImage(icono);
                                p1.setVisible(true);
                                Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                                AWTUtilities.setWindowShape(p1, shape);
                            }
                        }
                    }
                }

            } else {
                MensajesInfo p1 = new MensajesInfo('e', "TipoInforme");
                p1.setLocationRelativeTo(null);
                p1.setIconImage(icono);
                p1.setVisible(true);
                Shape shape = new RoundRectangle2D.Float(0, 0, p1.getWidth(), p1.getHeight(), 30, 30);
                AWTUtilities.setWindowShape(p1, shape);
            }
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void rbtnTrimestreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtnTrimestreActionPerformed
        dtpAnio.setEnabled(false);
        dtpMes.setEnabled(false);
        dtpDiaria.setEnabled(false);
        cboTrimestre.setEnabled(true);
        dtpAnio2.setEnabled(true);
        dtpAnio1.setEnabled(false);

        dtpAnio2.setValue(2013);
        dtpAnio1.setValue(2013);
        dtpAnio.setValue(2013);
        dtpMes.setMonth(1);
        dtpDiaria.setDate(null);
        cboTrimestre.setSelectedItem(null);
    }//GEN-LAST:event_rbtnTrimestreActionPerformed

    private void rbtnAnualActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtnAnualActionPerformed
        dtpAnio.setEnabled(true);
        dtpMes.setEnabled(false);
        dtpDiaria.setEnabled(false);
        cboTrimestre.setEnabled(false);
        dtpAnio2.setEnabled(false);
        dtpAnio1.setEnabled(false);

        dtpAnio2.setValue(2013);
        dtpAnio1.setValue(2013);
        dtpAnio.setValue(2013);
        dtpMes.setMonth(1);
        dtpDiaria.setDate(null);
        cboTrimestre.setSelectedItem(null);
    }//GEN-LAST:event_rbtnAnualActionPerformed

    private void rbtnDiariaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtnDiariaActionPerformed
        dtpAnio.setEnabled(false);
        dtpMes.setEnabled(false);
        dtpDiaria.setEnabled(true);
        cboTrimestre.setEnabled(false);
        dtpAnio2.setEnabled(false);
        dtpAnio1.setEnabled(false);

        dtpAnio2.setValue(2013);
        dtpAnio1.setValue(2013);
        dtpAnio.setValue(2013);
        dtpMes.setMonth(1);
        dtpDiaria.setDate(null);
        cboTrimestre.setSelectedItem(null);
    }//GEN-LAST:event_rbtnDiariaActionPerformed

    private void rbtnMensualActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtnMensualActionPerformed
        dtpAnio.setEnabled(false);
        dtpMes.setEnabled(true);
        dtpDiaria.setEnabled(false);
        cboTrimestre.setEnabled(false);
        dtpAnio2.setEnabled(false);
        dtpAnio1.setEnabled(true);

        dtpAnio2.setValue(2013);
        dtpAnio1.setValue(2013);
        dtpAnio.setValue(2013);
        dtpMes.setMonth(1);
        dtpDiaria.setDate(null);
        cboTrimestre.setSelectedItem(null);
    }//GEN-LAST:event_rbtnMensualActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCerrar;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JComboBox cboTrimestre;
    private com.toedter.calendar.JYearChooser dtpAnio;
    private com.toedter.calendar.JYearChooser dtpAnio1;
    private com.toedter.calendar.JYearChooser dtpAnio2;
    private com.toedter.calendar.JDateChooser dtpDiaria;
    private com.toedter.calendar.JMonthChooser dtpMes;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JRadioButton rbtnAnual;
    private javax.swing.JRadioButton rbtnDiaria;
    private javax.swing.JRadioButton rbtnMensual;
    private javax.swing.JRadioButton rbtnMotivo;
    private javax.swing.JRadioButton rbtnMotivoLlamado;
    private javax.swing.JRadioButton rbtnTrimestre;
    // End of variables declaration//GEN-END:variables
}
